<template>
  <div class="toast">
    <i class="iconfont" :class="type === 'warning'? 'icon-toast-jinggao':(type === 'success'?'icon-toast_chenggong':'icon-toast-shibai_huaban')"></i>
    <span>{{msg}}</span>
  </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
  data() {
    return {};
  },
  computed:{
    ...mapState({
      msg:state=>state.handleToast.msg,
      type:state=>state.handleToast.type
      
    })
  }
};
</script>

<style lang = "less" scoped>
.toast {
  position: fixed;
  left: 50%;
  top: 0;
  padding: 10px 15px;
  background-color: #fff;
  border-radius: 5px;
  font-size: 18px;
  transform: translateX(-50%);
  box-shadow: 0 0 6px #fff;
  .icon-toast_chenggong {
    color: green;
  }
  .icon-toast-jinggao {
    color: gold;
  }
  .icon-toast-shibai_huaban {
    color: red;
  }
  i{
    margin-right: 10px;
  }
}
</style>